# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
pkgname=py3-libmdbx
pkgver=0.10.2
pkgrel=6
pkgdesc="Python bindings for libmdbx"
url="https://gitlab.com/thermi/py3-libmdbx/"
arch="noarch !ppc64le" # test case segfaults in ppc64le
license="OLDAP-2.8"
depends="libmdbx"
makedepends="py3-setuptools"
checkdepends="py3-pytest"
subpackages="$pkgname-pyc"
source="py3-libmdbx-$pkgver.tar.gz::https://gitlab.com/Thermi/py3-libmdbx/-/archive/v$pkgver/py3-libmdbx-v$pkgver.tar.gz"

builddir="$srcdir/$pkgname-v$pkgver"

build() {
	python3 setup.py build
}

check() {
	case "$CARCH" in
	riscv64)
		PYTHONPATH="$PWD" python3 -m pytest . \
			--deselect libmdbx/tests/mdbx_test.py::TestMdbx::test_db_iter \
			--deselect libmdbx/tests/mdbx_test.py::TestMdbx::test_db_readitem_writeitem \
			--deselect libmdbx/tests/mdbx_test.py::TestMdbx::test_env \
			--deselect libmdbx/tests/mdbx_test.py::TestMdbx::test_multi_write \
			--deselect libmdbx/tests/mdbx_test.py::TestMdbx::test_replace \
			--deselect libmdbx/tests/mdbx_test.py::TestMdbx::test_success_close_written_map \
			--deselect libmdbx/tests/mdbx_test.py::TestMdbx::test_write
		;;
	*)
		PYTHONPATH="$PWD" python3 -m pytest .
		;;
	esac
}

package() {
	python3 setup.py install --skip-build --root="$pkgdir"
}

sha512sums="3014aa59b7b00c53442b9d2ad2a4ca55f61381c754ea8df1d38d6e26b5ab9109564026efc533a13f4d15fe7a45dbe507a75928a6b47932c89fe7a1d977dc38c4  py3-libmdbx-0.10.2.tar.gz"
